<?php
class  Front_Model_DbTable_Category  extends  Kieumau_Db_Common
{
	
	public function init(){
		
		parent::init();
		$this->_name = 'category';
		$this->fieldsPrimary = array('enabled', 'status', 'level', 'create_date', 'modify_date');
		$this->fieldsLanguage = array('name');
			
	}
	
	public function getCategoryName($categoryId, $defaultLanguage){
		try {
			$sql = 'SELECT name
					FROM '.$this->_name.'_language
					WHERE category_id = ?
					AND lang_id = ?
					';
			$result = $this->_db->fetchAll($sql, array($categoryId,$defaultLanguage));
				
			return $result;
		} catch ( Exception $ex ) {
			echo $ex->getMessage ();
		}
	}
	
}
